#include <Average.h>

int high = 0;
int low = 1024;
Average* average;

int printCount = 0;

void setup() {
  Serial.begin(9600);
  average = createAverageWithSampleSize(10);
}

void loop() {
  int value = analogRead(5);

  int ave = average->averageWithValue(value);

  if (ave > high) {
    high = ave;
    Serial.println("");
    Serial.print("High: ");
    Serial.println(high);
  } else if (ave < low) {
    low = ave;
    Serial.println("");
    Serial.print("Low: ");
    Serial.println(low);
  }
  
  printCount++;
  if (printCount == 3000) {
    Serial.print("value: ");
    Serial.print(value);
    Serial.print(" ave: ");
    Serial.println(ave);
    printCount = 0;
  }
  /*
  delay(20);
  */
}
